<?php
/**
 *	@author Jacken
 *	- Update infomation of user
 */

include_once('../Model/UserDetail.php');
include_once('../Model/Status.php');

session_start();

if(isset($_POST)) {

	$userID = $_SESSION['USER_ID'];

	$userDetail = new UserDetail();
	$userDetail = $userDetail->getUserDetail($userID);

	$userDetail->setUserID($userID);

	if(isset($_POST['txtStatus'])) {
		$status = new Status();
		$content = $_POST['txtStatus'];

		$status->setUserID($userID);
		$status->setContent($content);

		if($status->Insert($status)) {
			
		}
	}

	// Edit DesYourSelf
	if(isset($_POST['txtDesYourSelf'])) {

		$userDetail->setDesYourSelf($_POST['txtDesYourSelf']);
	}

	if(isset($_POST['txtFirstName'])) {
		$userDetail->setFirstName($_POST['txtFirstName']);
	}

	if(isset($_POST['txtLastName'])) {
		$userDetail->setLastName($_POST['txtLastName']);
	}

	if(isset($_POST['txtBirthDay'])) {
		$userDetail->setBirthDay($_POST['txtBirthDay']);
	}

	if(isset($_POST['slGender'])) {
		$userDetail->setGender($_POST['slGender']);
	}

	if(isset($_POST['txtNickName'])) {
		$userDetail->setNickName($_POST['txtNickName']);
	}

	if(isset($_POST['txtAdd'])) {
		$userDetail->setAdd($_POST['txtAdd']);
	}

	if(isset($_POST['txtShelterAdd'])) {
		$userDetail->setShelterAdd($_POST['txtShelterAdd']);
	}

	if(isset($_POST['txtHighSchool'])) {
		$userDetail->setHighSchool($_POST['txtHighSchool']);
	}

	if(isset($_POST['txtUniversity'])) {
		$userDetail->setUniversity($_POST['txtUniversity']);
	}

	if(isset($_POST['txtTel'])) {
		$userDetail->setTel($_POST['txtTel']);
	}

	if(isset($_POST['txtEmail'])) {
		$userDetail->setEmail($_POST['txtEmail']);
	}

	if($userDetail->Update($userDetail)) {
		header('localtion:c_UserPage.php?userID');
	}
 
	
	$location = "location:c_UserPage.php?userID=".$userID." id=userName";
	header($location);
	//Edit Personal
}

?>